<script setup>
import FootPage from './components/footPage.vue'
import HeadPage from './components/headPage.vue'
import { provide, nextTick, ref, onBeforeUnmount } from 'vue'
import { getUpdateOffline } from './interface/UserApi.js'

let data = ref({
	isAlive: true,
	isAlive2: true
})

/**
 * 重载方法
 */
function reload() {
	data.value.isAlive = false
	nextTick(() => {
		data.value.isAlive = true
	})
}
function reload2() {
	data.value.isAlive2 = false
	nextTick(() => {
		data.value.isAlive2 = true
	})
}
/**
 * 抛出重载方法
 */
provide('reload', reload)
provide('reload2', reload2)

onBeforeUnmount(() => {
	getUpdateOffline()
})
</script>

<template>
	<div class="flex flex-column h-dvh w-full">
		<head-page v-if="data.isAlive" ></head-page>
		<div class="flex-1 overflow-x-hidden overflow-y-scroll select-none">
			<router-view v-if="data.isAlive2"></router-view>
			<foot-page></foot-page>
		</div>
	</div>
</template>

<style scoped></style>
